package org.simple.framework.html.parser.convert.converter;

import org.simple.framework.html.parser.convert.TypeConverter;

/**
 * 项目名称：simple-framework
 * 类名称：LongConverter
 * 类描述：LongConverter
 * 创建时间：2018/9/25
 *
 * @author sisyphus   (E-mail:1620657419@qq.com)
 * @version v1.0
 */
public class LongConverter implements TypeConverter {

    @Override
    public boolean isSupported(Class clazz) {
        return Long.class.isAssignableFrom(clazz) || long.class.isAssignableFrom(clazz);
    }

    @Override
    public Long convert(Object o, Class clazz) {
        return o == null ? null : Long.valueOf((String) o);
    }

}
